﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SCRUM.Core.BusinessObjects;
using SCRUM.Core.DataProviders;

namespace SCRUM.Core.DAO
{
    /// <summary>
    /// Data access object project
    /// </summary>
    public static class DAOProject
    {
        /// <summary>
        /// Crates the specified project.
        /// </summary>
        /// <param name="project">The specific project.</param>
        /// <returns>Created project</returns>
        public static Project CreateNewProject(Project project)
        {
            return ProviderFactory.Provider.CreateProject(project);
        }

        /// <summary>
        /// Updates the specified project.
        /// </summary>
        /// <param name="project">The specific project.</param>
        public static void UpdateProject(Project project)
        {
            ProviderFactory.Provider.UpdateProject(project);
        }

        /// <summary>
        /// Deletes the specified project.
        /// </summary>
        /// <param name="projectID">The specific projectID.</param>
        public static void DeleteProject(int projectID)
        {
            ProviderFactory.Provider.DeleteProject(projectID);
        }

        /// <summary>
        /// Gets all projects.
        /// </summary>
        /// <param name="projectID">Index of the actual page.</param>
        /// <param name="releaseID">The release ID.</param>
        /// <param name="teamID">The team ID.</param>
        /// <param name="name">The name.</param>
        /// <param name="customer">The customer.</param>
        /// <param name="stateID">The state ID.</param>
        /// <returns>List with all projects in the system.</returns>
        public static IList<Project> GetAllProjects(int projectID, int releaseID, int teamID, string name, string customer, int stateID)
        {
            return ProviderFactory.Provider.GetAllProjects(projectID, releaseID, teamID, name, customer, stateID);
        }

        /// <summary>
        /// Gets all projects.
        /// </summary>
        /// <returns>List with all projects in the system.</returns>
        public static IList<Project> GetAllProjects()
        {
            return ProviderFactory.Provider.GetAllProjects();
        }

        /// <summary>
        /// Returns project according to its id
        /// </summary>
        /// <param name="projectId">ID of the project.</param>
        /// <returns>Project based on ID.</returns>
        public static Project GetProjectById(int projectId) 
        {
            return ProviderFactory.Provider.GetProjectById(projectId);
        }

        /// <summary>
        /// Gets the project by release.
        /// </summary>
        /// <param name="releaseID">The release.</param>
        /// <returns>project the release belongs to</returns>
        public static Project GetProjectByReleaseID(int releaseID)
        {
            return ProviderFactory.Provider.GetProjectByReleaseID(releaseID);
        }

        /// <summary>
        /// Gets the project by teamID.
        /// </summary>
        /// <param name="teamID">The team ID.</param>
        /// <returns></returns>
        public static Project GetProjectByTeam(int teamID)
        {
            return ProviderFactory.Provider.GetProjectByTeam(teamID);
        }
    }
}
